package com.authine.cloudpivot.ext.controller;

import com.authine.cloudpivot.engine.api.model.runtime.AttachmentModel;
import com.authine.cloudpivot.web.api.controller.OSSController;
import com.authine.cloudpivot.web.api.controller.base.BaseController;
import com.authine.cloudpivot.web.api.view.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

/**
 * @Author hxd
 * @Date 2021/11/2 15:30
 * @Description 客户自定义二开接口
 **/

@RestController
@RequestMapping("/customer/opt")
@Slf4j
public class CustController extends BaseController {


    @Autowired
    OSSController ossController;

    @PostMapping("updateBiz")
    public ResponseResult<String> updateBizObject(@RequestBody Map<String,Object> map) throws Exception {
        InputStream is = null;
        MultipartFile multipartFile = new MockMultipartFile("文件名称", is);


        ResponseResult<AttachmentModel> upload = ossController.upload(multipartFile, false, "", "", false, false);

        return getOkResponseResult("ok","");
    }

}
